package com.zl.autocode.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zl.autocode.controller.base.AutocodeBaseController;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateAddDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateDelDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateDetailDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateEditDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateQueryDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ReqCfgGenerateStateDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateAddDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateDelDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateDetailDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateEditDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateQueryDTO;
import com.zl.autocode.dto.autocode.cfgGenerate.ResCfgGenerateStateDTO;
import com.zl.autocode.service.autocode.ICfgGenerateService;
import com.zl.common.dto.ReqDTO;
import com.zl.common.dto.ResDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 代码生成配置
 * @author ZL
 */
@Api(value="代码生成配置",tags ="代码生成配置")
@RestController("autocodeCfgGenerateController")
@RequestMapping("/autocode/cfgGenerate")
public class CfgGenerateController extends AutocodeBaseController {

    @Autowired
    private ICfgGenerateService cfgGenerateService;
    
    /**
     * 查询
     */
    @ApiOperation(value="代码生成配置-查询")
    @RequestMapping(value="/list", method = RequestMethod.POST)
    public ResDTO<ResCfgGenerateQueryDTO> listCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateQueryDTO> reqInfo) throws Exception{
        ResCfgGenerateQueryDTO data = cfgGenerateService.queryCfgGenerateList(reqInfo);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="代码生成配置-详情")
    @RequestMapping(value="/detail", method = RequestMethod.POST)
    public ResDTO<ResCfgGenerateDetailDTO> detailCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateDetailDTO> reqInfo) throws Exception{
        ResCfgGenerateDetailDTO data = cfgGenerateService.queryCfgGenerateDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="代码生成配置-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
        public ResDTO<ResCfgGenerateAddDTO> addCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateAddDTO> reqInfo) throws Exception{
        ResCfgGenerateAddDTO data = cfgGenerateService.insertCfgGenerateInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="代码生成配置-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
        public ResDTO<ResCfgGenerateEditDTO> editCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateEditDTO> reqInfo) throws Exception{
        ResCfgGenerateEditDTO data = cfgGenerateService.updateCfgGenerateInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="代码生成配置-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
        public ResDTO<ResCfgGenerateDelDTO> delCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateDelDTO> reqInfo) throws Exception{
        ResCfgGenerateDelDTO data = cfgGenerateService.deleteCfgGenerateInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="代码生成配置-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
        public ResDTO<ResCfgGenerateStateDTO> stateCfgGenerate(@RequestBody ReqDTO<ReqCfgGenerateStateDTO> reqInfo) throws Exception{
        ResCfgGenerateStateDTO data = cfgGenerateService.updateCfgGenerateState(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="代码生成配置-删除")
    @RequestMapping(value="/delCfgGenerateAndDetail", method = RequestMethod.POST)
        public ResDTO<ResCfgGenerateDelDTO> delCfgGenerateAndDetail(@RequestBody ReqDTO<ReqCfgGenerateDelDTO> reqInfo) throws Exception{
        ResCfgGenerateDelDTO data = cfgGenerateService.deleteCfgGenerateAndDetail(reqInfo);
        return successDATA(data); 
    }
}